<template>
  <div class="waiter_details">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-button type="text" id="waiter_return" @click="toReturn">返回</el-button>
      <el-tab-pane label="基本信息" name="first">
        <div class="waiterDetails_card">
          <div class="card_img">
            <img src="../../assets/3.jpg" />
          </div>
          <div class="card_waiter">
            <div class="card_waiter_left">
              <div>用户名：</div>
              <div>姓名：</div>
              <div>联系方式：</div>
              <div>状态：</div>
              <div>住址：</div>
            </div>
            <div class="card_waiter_right">
              <div>{{this.waiterInfo.username}}</div>
              <div>{{this.waiterInfo.realname}}</div>
              <div>{{this.waiterInfo.telephone}}</div>
              <div>{{this.waiterInfo.status}}</div>
              <div>{{this.waiterInfo.province}}</div>
            </div>
          </div>
        </div>
      </el-tab-pane>
      <el-tab-pane label="订单信息" name="second">
        <el-table :data="waiterOrder" size="small" style="width: 100%" id="table_waiterOrder">
          <el-table-column prop="id" label="订单编号" min-width="78" align="center"></el-table-column>
          <el-table-column label="下单时间" min-width="214" align="center">
            <template slot-scope="{row}">
              <span>{{row.orderTime | dateParse}}</span>
            </template>
          </el-table-column>
          <el-table-column prop="total" label="总价" align="center" min-width="214"></el-table-column>
          <el-table-column prop="status" label="状态" align="center" min-width="214"></el-table-column>
          <el-table-column prop="customerId" label="顾客id" align="center" min-width="214"></el-table-column>
          <el-table-column label="操作" align="center" min-width="150">
            <el-button type="text" size="small" >详情</el-button>
          </el-table-column>
        </el-table>
      </el-tab-pane>
      <el-tab-pane label="收益信息" name="third">
        <el-table :data="waiterShou" size="small" style="width: 100%" id="table_waiterShou">
          <el-table-column prop="id" label="订单编号" min-width="78" align="center"></el-table-column>
          <el-table-column prop="money" label="金额" align="center" min-width="336"></el-table-column>
          <el-table-column prop="description" label="描述" align="center" min-width="336"></el-table-column>
          <el-table-column prop="" label="凭证" align="center" min-width="336"></el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import { mapState, mapActions } from "vuex";
export default {
  data() {
    return {
        page:0,
        pageSize:5,
        total:10,
      activeName: "first"
    };
  },
  created() {
    this.loadWaiter();
  },
  computed: {
    ...mapState("waiterDetails", ["waiterInfo","waiterOrder","waiterShou"])
  },
  methods: {
    ...mapActions("waiterDetails", ["toLoadWaiterInfo","toLoadWaiterOrder","toLoadWaiterShou"]),

    loadWaiter() {
      this.toLoadWaiterInfo(this.$route.query.id);
      this.toLoadWaiterOrder(this.$route.query.id);
      this.toLoadWaiterShou(this.$route.query.id)
    },
    handleClick(tab, event) {
    //   console.log(tab, event);
    },
    toReturn(){
      this.$router.push('waiter/list')
    }
  }
};
</script>
<style scope>
.waiter_details {
  padding: 10px;
}
.waiterDetails_card {
  width: 300px;
  height: 350px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-shadow: 5px 5px 5px #ddd;
  float: left;
  margin: 10px;
}
.card_img {
  width: 100%;
  height: 40%;
  position: relative;
}
.card_img img {
  width: 120px;
  height: 120px;
  display: block;
  position: absolute;
  margin: auto;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 50%;
}
.card_waiter {
  width: 100%;
  height: 60px;
}
.card_waiter_left {
  width: 40%;
  height: 100%;
  float: left;
}
.card_waiter_left > div {
  margin-top: 20px;
  text-align: right;
}
.card_waiter_right {
  width: 60%;
  height: 100%;
  float: right;
}
.card_waiter_right > div {
  margin-top: 20px;
  padding-left: 10px;
}
#waiter_return{
  padding:10px;
}
#table_waiterOrder{
  width:100%;
  height:calc(100vh - 190px);
  overflow-y: auto;
}
#table_waiterShou{
  width:100%;
  height:calc(100vh - 190px);
  overflow-y: auto;
}
</style>